﻿using Newtonsoft.Json.Linq;

namespace NetEasyMusic.Lib.Recommend;

public class PrivateContentRecommend
{
    public PrivateContentRecommend(JToken token)
    {
        Name = token["name"]?.ToObject<string>()!;
        Items = token["result"]?.Select(x => new PrivateContentItem(x)).ToArray() ?? [];
    }

    public string Name { get; set; }
    public PrivateContentItem[] Items { get; set; }
}

public class PrivateContentItem(JToken token) : IRecommend
{
    public string Id { get; set; } = token["id"]?.ToObject<string>()!;
    public string Copywriter { get; set; } = token["copywriter"]?.ToObject<string>()!;
    public string Name { get; set; } = token["name"]?.ToObject<string>()!;
    public string PicUrl { get; set; } = token["picUrl"]?.ToObject<string>()!;
}